<%@ page contentType="text/html" pageEncoding="UTF-8" session="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>

<jsp:useBean id="start" class="java.util.Date"/>

<!doctype html>
<html>
  <head>
    <title>JSP Implicit Objects...</title>
    <style type="text/css">
      table, th, td { border: 1px solid black }
      table { width: 100%; word-wrap: break-word }
      table caption { padding-top: 1ex; font-size: 120%; font-weight: bold }
      th { width: 20em; text-align: left }
      td { }
    </style>
  </head>
  <body>
    <h1>
      <c:out value="Implicit objects for ${pageContext.request.requestURL}" escapeXml="true"/>
    </h1>
    <table>
      <caption>pageContext</caption>
      <tr>
        <th>pageContext</th>
        <td><c:out value="${pageContext}"/></td>
      </tr>

      <c:if test="${not empty pageContext.errorData}">
        <tr>
          <th>pageContext.errorData</th>
          <td>
            <dl>
              <dt>Throwable</dt>
              <dd><c:out value="${pageContext.errorData.throwable}"/></dd>
              <dt>Status Code</dt>
              <dd><c:out value="${pageContext.errorData.statusCode}"/></dd>
              <dt>Request URI</dt>
              <dd><c:out value="${pageContext.errorData.requestURI}"/></dd>
              <dt>Servlet Name</dt>
              <dd><c:out value="${pageContext.errorData.servletName}"/></dd>
            </dl>
          </td>
        </tr>
      </c:if>

      <tr>
        <th>pageContext.exception</th>
        <td><c:out value="${pageContext.exception}"/></td>
      </tr>
      <tr>
        <th>pageContext.page</th>
        <td><c:out value="${pageContext.page}"/></td>
      </tr>
      <tr>
        <th>pageContext.request</th>
        <td><c:out value="${pageContext.request}"/></td>
      </tr>
      <tr>
        <th>pageContext.response</th>
        <td><c:out value="${pageContext.response}"/></td>
      </tr>
      <%--
         <tr>
           <th>pageContext.servletConfig</th>
           <td><c:out value="${pageContext.servletConfig}"/></td>
         </tr>
      <tr>
        <th>pageContext.servletContext</th>
        <td><c:out value="${pageContext.servletContext}"/></td>
      </tr>
      --%>
      <tr>
        <th>pageContext.session</th>
        <td><c:out value="${pageContext.session}"/></td>
      </tr>
    </table>

    <table>
      <%-- ServletRequest --%>
      <caption>pageContext.request</caption>
      <tr>
        <th>pageContext.request.attributeNames</th>
        <td>
          <ul>
	    <c:forEach var="i" items="${pageContext.request.attributeNames}">
              <li><c:out value="${i}"/></li>
            </c:forEach>
          </ul>
        </td>
      </tr>
      <tr>
        <th>pageContext.request.characterEncoding</th>
        <td><c:out value="${pageContext.request.characterEncoding}"/></td>
      </tr>
      <tr>
        <th>pageContext.request.contentLength</th>
        <td><c:out value="${pageContext.request.contentLength}"/></td>
      </tr>
      <tr>
        <th>pageContext.request.contentType</th>
        <td><c:out value="${pageContext.request.contentType}"/></td>
      </tr>
<%--
      <tr>
        <th>pageContext.request.dispatcherType</th>
        <td><c:out value="${pageContext.request.dispatcherType}"/></td>
      </tr>
--%>
      <tr>
        <th>pageContext.request.locale</th>
        <td>
          <c:out value="${pageContext.request.locale}"/>
          <dl>
            <dt>Language</dt>
            <dd><c:out value="${pageContext.request.locale.language}"/></dd>
            <dt>Country</dt>
            <dd><c:out value="${pageContext.request.locale.country}"/></dd>
            <dt>Variant</dt>
            <dd><c:out value="${pageContext.request.locale.variant}"/></dd>
          </dl>
        </td>
      </tr>
      <tr>
        <th>pageContext.request.locales</th>
        <td>
          <ul>
	    <c:forEach var="i" items="${pageContext.request.locales}">
              <li><c:out value="${i}"/></li>
            </c:forEach>
          </ul>
        </td>
      </tr>
      <tr>
        <th>pageContext.request.localAddr</th>
        <td><c:out value="${pageContext.request.localAddr}"/></td>
      </tr>
      <tr>
        <th>pageContext.request.localName</th>
        <td><c:out value="${pageContext.request.localName}"/></td>
      </tr>
      <tr>
        <th>pageContext.request.localPort</th>
        <td><c:out value="${pageContext.request.localPort}"/></td>
      </tr>
      <tr>
        <th>pageContext.request.parameterMap</th>
        <td>
          <ul>
	    <c:forEach var="e" items="${pageContext.request.parameterMap}">
              <li>
                <c:out value="${e.key}"/>:
	        <c:forEach var="i" items="${e.value}">
                  <c:out value="${i}"/>
                </c:forEach>
              </li>
            </c:forEach>
          </ul>
        </td>
      </tr>
      <tr>
        <th>pageContext.request.parameterNames</th>
        <td>
          <ul>
	    <c:forEach var="i" varStatus="status" items="${pageContext.request.parameterNames}">
              <li><c:out value="${i}"/></li>
            </c:forEach>
          </ul>
        </td>
      </tr>
      <tr>
        <th>pageContext.request.protocol</th>
        <td><c:out value="${pageContext.request.protocol}"/></td>
      </tr>
      <tr>
        <th>pageContext.request.remoteAddr</th>
        <td><c:out value="${pageContext.request.remoteAddr}"/></td>
      </tr>
      <tr>
        <th>pageContext.request.remoteHost</th>
        <td><c:out value="${pageContext.request.remoteHost}"/></td>
      </tr>
      <tr>
        <th>pageContext.request.remotePort</th>
        <td><c:out value="${pageContext.request.remotePort}"/></td>
      </tr>
      <tr>
        <th>pageContext.request.scheme</th>
        <td><c:out value="${pageContext.request.scheme}"/></td>
      </tr>
      <tr>
        <th>pageContext.request.serverName</th>
        <td><c:out value="${pageContext.request.serverName}"/></td>
      </tr>
      <tr>
        <th>pageContext.request.serverPort</th>
        <td><c:out value="${pageContext.request.serverPort}"/></td>
      </tr>
      <tr>
        <th>pageContext.request.secure</th>
        <td><c:out value="${pageContext.request.secure}"/></td>
      </tr>
      <%-- HttpServletRequest --%>
      <tr>
        <th>pageContext.request.authType</th>
        <td><c:out value="${pageContext.request.authType}"/></td>
      </tr>
<%--
      <tr>
        <th>pageContext.request.contextPath</th>
        <td><c:out value="${pageContext.request.contextPath}"/></td>
      </tr>
--%>
      <tr>
        <th>pageContext.request.cookies</th>
        <td>
          <ul>
	    <c:forEach var="i" items="${pageContext.request.cookies}">
              <li><c:out value="${i}"/></li>
            </c:forEach>
          </ul>
        </td>
      </tr>
      <tr>
        <th>pageContext.request.headerNames</th>
        <td>
          <ul>
	    <c:forEach var="i" items="${pageContext.request.headerNames}">
              <li><c:out value="${i}"/></li>
            </c:forEach>
          </ul>
        </td>
      </tr>
      <tr>
        <th>pageContext.request.method</th>
        <td><c:out value="${pageContext.request.method}"/></td>
      </tr>
      <tr>
        <th>pageContext.request.pathInfo</th>
        <td><c:out value="${pageContext.request.pathInfo}"/></td>
      </tr>
      <tr>
        <th>pageContext.request.pathTranslated</th>
        <td><c:out value="${pageContext.request.pathTranslated}"/></td>
      </tr>
      <tr>
        <th>pageContext.request.queryString</th>
        <td><c:out value="${pageContext.request.queryString}"/></td>
      </tr>
      <tr>
        <th>pageContext.request.remoteUser</th>
        <td><c:out value="${pageContext.request.remoteUser}"/></td>
      </tr>
<%--
      <tr>
        <th>pageContext.request.requestedSessionId</th>
        <td><c:out value="${pageContext.request.requestedSessionId}"/></td>
      </tr>
--%>
      <tr>
        <th>pageContext.request.requestURI</th>
        <td><c:out value="${pageContext.request.requestURI}"/></td>
      </tr>
      <tr>
        <th>pageContext.request.requestURL</th>
        <td><c:out value="${pageContext.request.requestURL}"/></td>
      </tr>

<%--
      <tr>
        <th>pageContext.request.servletPath</th>
        <td><c:out value="${pageContext.request.servletPath}"/></td>
      </tr>

      <tr>
        <th>pageContext.request.scriptName</th>
        <td><c:out value="${pageContext.request.scriptName}"/></td>
      </tr>
--%>

      <tr>
        <th>pageContext.request.session</th>
        <td><c:out value="${pageContext.request.session}"/></td>
      </tr>
<%--
      <tr>
        <th>pageContext.request.userPrincipal</th>
        <td><c:out value="${pageContext.request.userPrincipal}"/></td>
      </tr>
      <tr>
        <th>pageContext.request.requestedSessionIdFromCookie</th>
        <td><c:out value="${pageContext.request.requestedSessionIdFromCookie}"/></td>
      </tr>
      <tr>
        <th>pageContext.request.requestedSessionIdFromURL</th>
        <td><c:out value="${pageContext.request.requestedSessionIdFromURL}"/></td>
      </tr>
      <tr>
        <th>pageContext.request.requestedSessionIdValid</th>
        <td><c:out value="${pageContext.request.requestedSessionIdValid}"/></td>
      </tr>
--%>
    </table>

    <table>
      <caption>pageContext.response</caption>
      <%-- ServletResponse --%>
<%--
      <tr>
        <th>pageContext.response.bufferSize</th>
        <td><c:out value="${pageContext.response.bufferSize}"/></td>
      </tr>
--%>
      <tr>
        <th>pageContext.response.characterEncoding</th>
        <td><c:out value="${pageContext.response.characterEncoding}"/></td>
      </tr>
      <tr>
        <th>pageContext.response.contentType</th>
        <td><c:out value="${pageContext.response.contentType}"/></td>
      </tr>
      <tr>
        <th>pageContext.response.locale</th>
        <td><c:out value="${pageContext.response.locale}"/></td>
      </tr>
<%--
      <tr>
        <th>pageContext.response.committed</th>
        <td><c:out value="${pageContext.response.committed}"/></td>
      </tr>
--%>
    </table>

    <c:if test="${not empty pageContext.session}">
      <table>
        <caption>pageContext.session</caption>
        <%-- HttpSession --%>
        <tr>
          <th>pageContext.session.attributeNames</th>
          <td>
            <ul>
	      <c:forEach var="i" items="${pageContext.session.attributeNames}">
                <li><c:out value="${i}"/></li>
              </c:forEach>
            </ul>
          </td>
        </tr>
        <tr>
          <th>pageContext.session.creationTime</th>
          <td><c:out value="${pageContext.session.creationTime}"/></td>
        </tr>
        <tr>
          <th>pageContext.session.id</th>
          <td><c:out value="${pageContext.session.id}"/></td>
        </tr>
        <tr>
          <th>pageContext.session.lastAccessedTime</th>
          <td><c:out value="${pageContext.session.lastAccessedTime}"/></td>
        </tr>
        <tr>
          <th>pageContext.session.maxInactiveInterval</th>
          <td><c:out value="${pageContext.session.maxInactiveInterval}"/></td>
        </tr>
<%--
        <tr>
          <th>pageContext.session.new</th>
          <td><c:out value="${pageContext.session.new}"/></td>
        </tr>
--%>
      </table>
    </c:if>

    <c:if test="${not empty pageScope}">
      <table>
        <caption>pageScope</caption>
        <c:forEach var="e" items="${pageScope}">
	  <tr>
            <th><c:out value="${e.key}"/></th>
            <td><c:out value="${e.value}"/></td>
          </tr>
        </c:forEach>
      </table>
    </c:if>

    <c:if test="${not empty requestScope}">
      <table>
        <caption>requestScope</caption>
        <c:forEach var="e" items="${requestScope}">
	  <tr>
            <th><c:out value="${e.key}"/></th>
            <td><c:out value="${e.value}"/></td>
          </tr>
        </c:forEach>
      </table>
    </c:if>

    <c:if test="${not empty sessionScope}">
      <table>
        <caption>sessionScope</caption>
        <c:forEach var="e" items="${sessionScope}">
	  <tr>
            <th><c:out value="${e.key}"/></th>
            <td><c:out value="${e.value}"/></td>
          </tr>
        </c:forEach>
      </table>
    </c:if>

    <c:if test="${not empty applicationScope}">
      <table>
        <caption>applicationScope</caption>
        <c:forEach var="e" items="${applicationScope}">
	  <tr>
            <th><c:out value="${e.key}"/></th>
            <td><c:out value="${e.value}"/></td>
          </tr>
        </c:forEach>
      </table>
    </c:if>

    <c:if test="${not empty param}">
      <table>
        <caption>param</caption>
        <c:forEach var="e" items="${param}">
	  <tr>
            <th><c:out value="${e.key}"/></th>
            <td><c:out value="${e.value}"/></td>
          </tr>
        </c:forEach>
      </table>
    </c:if>

    <c:if test="${not empty paramValues}">
      <table>
        <caption>paramValues</caption>
        <c:forEach var="e" items="${paramValues}">
	  <tr>
            <th><c:out value="${e.key}"/></th>
            <td>
              <ul>
	        <c:forEach var="i" items="${e.value}">
                  <li><c:out value="${i}"/></li>
                </c:forEach>
              </ul>
            </td>
          </tr>
        </c:forEach>
      </table>
    </c:if>

    <c:if test="${not empty header}">
      <table>
        <caption>header</caption>
        <c:forEach var="e" items="${header}">
	  <tr>
            <th><c:out value="${e.key}"/></th>
            <td><c:out value="${e.value}"/></td>
          </tr>
        </c:forEach>
      </table>
    </c:if>

    <c:if test="${not empty headerValues}">
      <table>
        <caption>headerValues</caption>
        <c:forEach var="e" items="${headerValues}">
	  <tr>
            <th><c:out value="${e.key}"/></th>
            <td>
              <ul>
	        <c:forEach var="i" items="${e.value}">
                  <li><c:out value="${i}"/></li>
                </c:forEach>
              </ul>
            </td>
          </tr>
        </c:forEach>
      </table>
    </c:if>

    <c:if test="${not empty cookie}">
      <table>
        <caption>cookie</caption>
        <c:forEach var="e" items="${cookie}">
	  <tr>
	    <th><c:out value="${e.key}"/></th>
	    <td><c:out value="${e.value.value}"/></td>
	  </tr>
        </c:forEach>
      </table>
    </c:if>

    <c:if test="${not empty initParam}">
      <table>
        <caption>initParam</caption>
        <c:forEach var="e" items="${initParam}">
	  <tr>
            <th><c:out value="${e.key}"/></th>
            <td><c:out value="${e.value}"/></td>
          </tr>
        </c:forEach>
      </table>
    </c:if>

    <jsp:useBean id="end" class="java.util.Date"/>

    <p>Execution took ${end.time - start.time} ms.</p>
  </body>
</html>
